Add a comment to tricky corner case in evtchn_close().
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Sun, 4 Dec 2005 10:54:04 +0000 (11:54 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Sun, 4 Dec 2005 10:54:04 +0000 (11:54 +0100)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/common/event_channel.c

index 6f5a34774b0f6ac314eceb40b5d1412b0ce5f8e9..c3ef30ce34a5701c803ccd35e06334835a60cdef 100644 (file)
@@ -344,6 +344,14 @@ static long __evtchn_close(struct domain *d1, int port1)
         }
         else if ( d2 != chn1->u.interdomain.remote_dom )
         {
+            /*
+             * We can only get here if the port was closed and re-bound after
+             * unlocking d1 but before locking d2 above. We could retry but
+             * it is easier to return the same error as if we had seen the
+             * port in ECS_CLOSED. It must have passed through that state for
+             * us to end up here, so it's a valid error to return.
+             */
+            BUG_ON(d1 != current->domain);
             rc = -EINVAL;
             goto out;
         }